2. bottle filling and capping machine 2
所以我们有一台新机器,我们需要开始为其编写控制软件。
So we have a new machine and we need to start writing the control software for it.
我们将使用迄今为止开发的所有工具,因此我们需要在其中实现通用设备。
We will use all the tools that we have developed so far, so we will need to implement the generic devices within it.
所以在这里我将为我们的通用设备创建一个新的全局变量列表。
So here I will create a new global variable list for our generic devices.
所以我将其称为 Gvul 下划线通用设备。
So I will call this Gvul underscore generic devices.
我将仅删除限定的属性,然后在右侧打开可视化,以便一起查看该计算机上的设备。
I will remove the attribute qualified only and I will open here on the right the visualisations in order to take a look together on which are the devices on this machine.
到目前为止,谈话涉及哪些内容?
So far, what concerns the conversation?
当然,我们有传送带,我将其称为传送带设备。
We have, of course, the conveyor and I will call this conveyor device.
将会有一个联邦调查局通用设备。
There will be an FBI generic device.
转到这里的站,我们有一个感觉设备,我将这样称呼它,然后用于与封盖站有关的内容。
Moving on to the stations here, we have a feeling device that I will call in this way then for what concerns the capping station.
我们有两种设备,一种用于管理封盖站的移动,另一种用于控制实际封盖。
We have two devices, one that manages the capping station movement and one that controls the actual capping.
所以我将第一个相同类型的封盖运动装置称为B类通用装置。
So I will call the first one capping movement device of the same type B generic device.
然后我们有第二个,我称之为封盖装置。
Then we have the second one that I would call capping device.
该类型同样是 FBI 通用设备。
The type is, again, an FBI generic device.
他们正在转向我们这里的机器人。
They're moving on to the robot we have here.
一种管理运动的设备。
One device that manages the movement.
机器人的水平运动,例如,我们可以称之为机器人水平设备,该类型是一种大型通用设备,另一种称为机器人,具有机器人垂直设备,该设备将处理机器人的垂直运动。
The horizontal movement of the robot, so we can call this, for instance, robot horizontal device and the type is a big generic device, another one that will be called robot with a robot vertical device that will handle the vertical movement of the robot.
最后一个是 Agrippa,机器人的抓手。
And the last one is Agrippa, the gripper for the robot.
所以我们称这个机器人修剪器设备为那个设备。
So we call this robot clipper device, that device.
这些是我们为这台机器准备的设备。
So these are our devices for this machine.
我们有七个,因此我们需要在主编程中创建对所有设备的调用,并且需要在通用设备中实际配置它们。
We have seven of them, and therefore we need to create a call to all of our devices in our main programming, and we need to actually configure them within the generic devices.
因此,让我们首先在主程序中创建一个操作,就像在上一个项目中一样,我将调用通用设备调用下划线操作。
So let's start by creating an action within the main program that, as in the previous project, I will call generic devices call underscore action.
我需要在主程序中调用此操作。
And I will need to call this action over here in the main program.
所以就这样。
So in this way.
在这里,我们会的。
And over here, we will.
呼叫我们所有的通用设备。
Place the the calls to all of our generic devices.
那么让我们从第一个开始吧。
So let's start from the first one.
第一个是输送机。
The first one is the conveyers.
所以我就从这里开始写。
So I will start writing here.
抱歉,请转达您的设备。
Sorry, convey your device.
让我们删除所有问号。
And let's remove all the question marks.
为了让我们更快,我将总共复制并粘贴七次,以便有七个设备调用。
And in order to make it faster for us, I will copy and paste this seven times in total in order to have seven devices calls.
让我们从第一个开始,即传送带。
So let's start from the first one, the conveyor.
这里我们有一个驱动。
Here we have one actuation.
这实际上是关于传送带移动与否的问题。
That is actually about the conveyor moving or not.
我的意思是,我们只有一个执行器来移动它,然后我们在这里打开它。
I mean, we have just an actuator to move it and we open it here.
此移动传送带。
This move conveyor.
因此,我将通过插入分配将其移至启用的设备执行器中。
So I will move it over here into the enabled device actuator by inserting an assignment, the.
所以这将是一个单一的激活设备,一个单一的激活。
So this will be a single activation device, a single activation.
在这种情况下,我们还有一个反馈可以告诉我们计算机是否正在移动。
And we also have in this case one single feedback that will tell us if the computer is moving.
所以,一个反馈真是太好了,抱歉,单身。
So how great of a single feedback, sorry, single.
这将是单个启用反馈。
This would be a single enable feedback.
抱歉,因为它会告诉我们传送带何时启用。
Sorry, because it will tell us when the conveyor is enabled.
好的,所以在设备启用的传感器中,我们将放置传送带移动传感器。
OK, so here in the device enabled sensor, we will place the conveyor moving sensor.
让我们设置一些非常小的激活时间,比如说重新激活和激活都是 100 毫秒,抱歉,一百毫秒。
And let's place some very small activation times, let's say 100 sorry, hundred milliseconds for both reactivation and the activation.
因此,在这里,我将编写哈希标签零点一秒,然后将其复制并粘贴到停用中。
So here, I'll write the hash tag zero point one seconds and I will copy and paste this into the deactivations.
好的,现在让我们继续第二个。
OK, now let's move on to the second one.
那是我们的感觉装置。
That was our feeling device here.
在这里我们有一种感觉,我感觉,感觉恶习。
Here we have a feeling, I feel, feeling the vice.
同样,这里我们只有一个执行器和一个反馈,因此我们实际上可以复制此配置,因为这也是单个启用的反馈和单个激活设备,并且作为我们拥有的反馈和启用反馈,我们将在此处执行此操作,流程传感器和执行器一样,我们有感觉执行器。
Again, here we have only one actuator and one feedback so we can actually copy this configuration because this is a single enabled feedback as well and the single activation device and as the feedback we have and enable feedback here that we will do this, the flow sensor and as the actuator, we have the feeling actuator.
太对了。
So right.
单击插入分配填充执行器。
Click insert assignment filling actuator.
然后继续,我们的封盖站,正如我所说,有两种不同的设备,一种是封盖移动设备,这也是单个启用的反馈和单个激活,因为我们只有一个执行器,即移动封盖站已停机,还有一个传感器可以告诉我们它何时实际停机。
Then moving on, we have the capping station that, as I said, has two different devices, one that is the capping movement device and this as well is a single enabled feedback and single activation because we have only one actuator that is this move capping station down and one sensor that tells us when it is actually down.
因此,我再次将其限制在这里,单一且有效的反馈和单一激活权限。
So again, I will cap it is here, single and able feedback and single activation authority.
我们还假设感知装置的时间非常小。
Let's also assume very small times here for the feeling device.
一百毫秒就可以了,我们这里的“不”也是如此。
A hundred milliseconds will work and the same goes for our no here.
我们实际上需要更长一点的时间,比如说一秒钟,因为这是封盖站需要下降的时间。
We will need actually a little bit longer, let's say one second, because this is the time that the capping station needs to get down.
所以在这里,我们的 ANÍBAL 传感器将是封盖站向下传感器,抱歉,那个站,Shinedown 传感器,我想它被称为,我们在这里激活,这将插入一个分配,并将成为新的封盖站向下。
So here, our ANÍBAL sensor will be the capping station down sensor sorry, that station, Shinedown Sensor, I guess it is called, and our activation here, that's insert an assignment and will be the new capping station down.
好的,我们几乎完成了传送带上的设备。
OK, we are almost done for the devices on the conveyor.
这里我们还有最后一个,那就是封盖装置,封盖装置实际上就在这里。
Here we have the last one, that is the capping device, capping device that is actually here.
我们只需激活即可。
We simply have the activation.
正如您在全球语言中看到的那样,我们没有任何传感器。
We don't have any sensors, as you can see in the global verbalised.
这是。
And this is.
实际上,没有反馈装置。
Actually, no feedback device.
再次,一次驱动。
And again, a single actuation.
在这里,我们需要添加。
Here, we will need to add.
激活和激活的上限时间,我们需要的实际上限时间是零点五秒。
Capping time for the activation and the activation, the actual capping time that we need is so let's right for now zero point five seconds.
激活也是如此。
And the same goes for the activation.
所以这里我们只需要分配一个称为封盖执行器的执行器,我猜。
So here we need just to assign the actuator that is called the capping actuator, I guess.
是的。
Yes.
好的,我们管理了传送带的所有四个通用设备。
OK, so we managed all the four generic devices for the conveyor.
我们有输送机、流程、灌装装置、封盖站运动。
We have the conveyor, the flow, the the filling device, the capping station movement.
向上或向下以及封盖装置,然后我们需要移动到机器人上,我们必须平移到,呃,过渡时刻,这里我们有水平运动和垂直运动。
Up or down and the capping device, then we need to move on to the robot and we have to translation's to, uh, the transition moments, and here we have a horizontal movement and a vertical movement.
这两个设备都与我们之前项目中的电梯非常相似,或者也与真正的上下运动非常相似,因为这实际上是它们都是双驱动的。
And both of these devices are quite similar to the elevator that we had in the previous project or also the real movement up or down, because this is actually the both of them are actually double actuation.
它们都是反馈装置。
They are both feedback devices.
所以在这里我们将创建使用它来激活。
So here we will create use this for activation.
有四个传感器。
And there's four sensors.
所以我们的第五个装置将是机器人水平移动装置。
So our fifth device will be the robot horizontal movement device.
抱歉,我称这个机器人为卧式。
Sorry, I call this robot horizontal.
这里。
Here.
这里我们有双重反馈和双重驱动。
Here we have a double feedback and a double actuation.
我们用耳朵作为激活和激活时间,我们需要机器人从左向右移动所需的时间,这是相当长的时间。
We have our ear as an activation and the activation times, we need the time it takes the robot to move from left to right and it is quite a bit of a long time.
所以我五秒钟就到了这里。
So I arrived here five seconds.
我们的设备启用传感器将是我们实际上可以双向思考的一年,正如我们在另一个项目中看到的那样。
And our device enables sensor will be the year we can actually think it both ways, as we saw in the other project.
对于我们来说,可以将机器人视为启用状态,将机器人视为禁用状态。
And for us, it could be OK to think of the robot up as enabled a robot down as disabled.
因此,在启用传感器中,我们是对的,机器人向上传感器在这里,我们将有机器人向下传感器,并且作为激活,我们将在这里有一定的分配和机器人。
So in the enable sensor, are we right, the robot up sensor down here, we will have the robot down sensor and as the activations we will have here a certain assignment and robot.
所以把机器人拆了。
So remove robot up.
这里稍微向下移动一点。
And a move a bit down over here.
因此,垂直运动,与垂直装置是完全相同的。
Therefore, the vertical movement, it is quite the same thing about vertical device.
我们将再次获得双重反馈、双重激活。
We will have, again, double feedback, double activation.
再次,让我们面对五秒作为激活和激活时间。
Again, let's face five seconds as the activation and the activation time.
和这里。
And here.
抱歉,我搞砸了。
Sorry, I messed up.
抱歉,这是垂直的。
Sorry, this was the vertical one.
这就是垂直设备。
So this was the vertical device.
而这个是水平的。
And this one is the horizontal.
这里我们可以认为机器人左为停用,机器人右为。
Here we can think as robot left as deactivated and robot right.
激活后。
As activated.
所以你就在启用右边。
So you're are right on the enable right.
机器人右侧传感器位于下方。
Robot right sensor below.
我们将有机器人左传感器,并且作为激活,我们将在这里将机器人向右移动,机器人向左移动。
We will have robot left sensor and as the activations we will have here move robot uh right and robot left.
那么最后一种就是机器人修复机器人修复装置。
Then the last one is the robotic repair robot repair device.
那实际上是一个无反馈设备,所以这里我们就写无反馈,激活是单次激活。
That is actually a no feedback device, so here we will write no feedback, the activation is a single activation.
我们可以想象一个激活时间,例如零点五秒。
We can think of an activation time that can be there, say, zero point five seconds.
这实际上意味着抓取产品的时间,并且由于我们没有传感器,所以激活很抱歉,激活的是机器人。
That will actually mean the time to grab the product and as we have no sensors, the activation is sorry, the activation is the robot.
呃,罗伯特,抓手致动器。
Uh, Robert, Griper Actuator.
好的,这应该是我们的设备,我们的汽车在这里,让我们以与其他程序中相同的方式执行此操作,我们还需要实际处理对车站的呼叫。
OK, so this should be our devices, we have our car here and let's do this in the same way that we did in the other programs, we need to actually handle also the calls to the stations.
首先,我们需要创建电台。
So first, we need to create the stations.
让我们在模块化程序文件夹中创建它们。
Let's create them within our modular program folder.
因此,让我们右键单击,添加一个对象,然后创建一个流行的程序。
So let's right click, add an object and let's have a popular program.
第一个将被称为传送站。
And the first one will be called the conveyor station.
第二个将被调用。
And the second one will be called.
这里有机器人站。
And here you have the robot station.
正如我们之前所做的那样,对,实际上,我们两个站都需要所有变量,所以对于对话,让我们从输入的输入开始。
So as we did before last, right, surely all the variables that we need for both of the stations, actually, so for the conversation, let's start from the input of our input.
我们将一如既往地有一个启动输入。
We will have, as always, a start input.
将有一个音量可变停止输入。
There will be a volume variable stop input.
将会有一个音量可变或保持。
There will be a volume variable or hold.
还有紧急情况。
And the emergency.
好的,随着互联网的可行,我们肯定需要一个无符号整数的状态,而作为另一台机器,我们将有一个旧的状态和旧的请求。
OK, as the Internet viable, we will surely need a state as an unsigned integer and as the other machine, we will have an old state and an old requests.
这些肯定既不是布尔变量,也不是 less,对吧。
These are surely neither as boolean variable and less, right.
此外,我们只需要我们的站、数据站、状态将处于新的站状态。
Also the outputs we will need only our stations, data stations, state there will be at a new station state.
好的,这很好。
OK, so this is good.
我们可以直接将其复制到滚动站中,所以请避免,避免在此处复制名称。
Let's we can directly copy this into the roll station, so just avoid, avoid copying the name here.
所以复制并粘贴。
So copy and paste.
好的。
OK.
现在,让我们在此处添加对我们的车站和操作的调用,就像我们在另一个项目中所做的那样,卡尔车站是一个..
So let's now add a call for our stations and action here that we will call, as we did in the other project, the station, Carl, is a..
更正。
Correction.
我们将首先在此处插入对我们的传送带站的调用。
And we will insert here first the call to our conveyor conveyor station.
哦,抱歉,我需要听听传达您的电台,让我们将其复制并粘贴到机器人电台。
Oh, I'm sorry, I need to hear convey your station and let's copy and paste this to the robot station.
所以在这里我们可以直接开始,我们可以先删除问号,我们可以直接这样做,因为我们发现,就像我们在项目结束时所做的那样,这意味着我们将管理我们将创建一个实际的主状态机这。
So here we can directly start, we can remove first the question marks and we can directly do this as we find out, as we did it in the end of our project, meaning that we will manage we will create an actual main state machine for this.
我们实际上可以像以前一样这样做。
And we can actually do this in the same way as we did before.
你可以从中复制谁,或者你可以简单地关注我。
Who you can copy from that or you can simply follow me.
因此,在我们的主程序中,我将在此处的所有内容之前添加车站购物车操作。
So here in our main program, I will add the station cart action before everything here.
我将在主要问题状态中创建一个状态变量作为无符号整数,我们将从创建状态机开始。
I will create a state variable in the main problem state as an unsigned integer, and we will start by creating our state machine.
所以状态为零的情况。
So case state of state zero.
机器没有运行所以机器处于未运行状态和状态。
The machine is not running so machine not running state and in the state.
我们需要将所有起始站和车站的所有输入设置为 false。
We need to have both all the the start stop and all the inputs of the station set to false.
所以在这里我要么传达你的站不启动。
So here I can either convey your station not start.
应该是假的。
Should be false.
复制并粘贴此内容。
Copy and paste this.
对于停止和整个输入也是如此,对于传送站来说,我们可以复制所有这些并粘贴它。
The same goes for the stop and the whole input, both for the conveyor station, we can copy all of this and paste it.
如果您按住热按钮,反对派候选人可以修改多行。
And for the opposition candidate to modify multiple line if you hold the hot button.
对了,罗伯特站。
Right, Robert Station.
最后,我会,一切,在这里,如果有这个开始按钮,没有停止按钮,没有保持按钮,也没有紧急按钮,那么我们需要转换到另一个状态,那么如果发生这种情况,我们将需要去另一个州。
And I will, in the end, everything, and here we will need to have a transition to another state if there is this start button and not the stop button and not the hold button and not the emergency button, then if this happens, we will need to go to another state.
我们称状态等于 10。
Let's call the state equal to 10.
我们需要设定所有这些所有的状态,通过这个国家的输入。
And we need to set all of these all of the state of the start, the input of this nation through.
所以转达你的歉意。
So convey your sorry.
传达你的电台,而不是开始。
Convey your station, not start.
设置true并将Robert Station start设置为true,OK,就像我们之前在状态中所做的那样,10需要等待所有站都运行起来,因此我们将在这里等待。
Set the true and Robert Station start set to true, OK, as we did before here in state, 10 need to wait for all stations to be running and therefore we will wait here.
对于输送站,该状态等于中午运行的站状态,对于机器人站也是如此。
For conveyor station, that state to be equal to the noon station state that running and the same goes for the robot station.
所以,罗伯特站,那个状态应该等于 Enuma 站状态。
So, Robert Station, that state should be equal to the Enuma station state.
那么运行起来,如果我们同时具备这两个条件,我们实际上就可以删除被按下的开始按钮了。
That running then, if we have both of these conditions, we can actually remove the start button being pressed.
因此,请传送以强制方式启动的站,启动的机器人站也将被设置为强制。
So convey your station that start with the force and the robot station that start will be set to force as well.
我们可以将状态移动到机器正在运行的任何状态。
And we can move the state to any in which the machine is running.
而这里的这种状态,我们其实根本就什么都做不了。
And in this state here, we can actually do nothing at all.
机器正在运行,我们不需要发送任何其他信息。
The machine is running and we do not need to send any any other.
无法向电台发表您的评论。
Can't come in your comments to the stations.
另外,抱歉,我想我们。
Also, sorry, I guess we.
让我看看。
Let me see.
哦,抱歉,这不是州,而是车站州,是的。
Oh, sorry, this was this is not the state, but the station state, yeah.
现在这里有四个我们需要管理停止并保持所有紧急程序,所以在这里我们可以直接进入我们世界的紧急情况管理部分。
And there are four here now we need to manage the stop and hold all an emergency procedures, so here we can go right to the part of our world in the emergency emergency management.
因此,如果按下紧急按钮或者出现故障,正如您在信号管理中看到的那样,我们已经有了全局变量列表,即全局信号列表的方式。
So if the emergency button is pressed or if we have a fault, as you can see here in the signal management, we already have the global variable list, the way that the global signal lists.
所以即使我们现在没有使用它,我们也可以直接指向它。
So we can directly point to this even if we are not using it at this at this moment.
因此,如果紧急按钮或全局信号列表激活警报,并且这些条件之一为真,则状态必须等于零。
So if emergency button or global signal list that alarms active, if one of these conditions is true, state must be equal to zero.
我们实际上需要将此条件作为我们这里的站的输入和紧急输入。
And we need to actually place this condition as the input for our and our emergency input for our stations over here.
好的,这就是关于警报、员工和管理人员的紧急情况和警报的问题,我们需要说的是,如果我们的停止按钮被按下并且我们不处于状态,Ziva。
OK, this is what concerns the alarm, the emergencies and alarms for the staff and management, we need to say that if our stop button is being pressed and we are not in the state, Ziva.
我们还没有处于那种我们将再次使用武力阻止的状态。
And we are not in the state thousand that, again, we will use force to stop.
我们需要设置站点的两个输入。
We need to set both of the inputs for the stations.
我们也可以。
So can we.
你的站、站应该等于真实而稳健的站。
Your station, the stop should be equal to true and robust station.
当我们移动到等于 1000 的状态时,停止点应该等于 true。
The stop should be equal to truth while we move to state equal to 1000 in our state.
一千。
One thousand.
这将是我们在这里的停止状态。
That will be our stop state over here.
我们需要等待我们所有的站实际上处于未运行状态。
We need to wait for all our station to actually be in the not running state.
所以我可以在这里复制这一行,我们等待车站运行,但它们根本不在 Numerati 中。
So I can copy this line here, which we wait for the stations to be running and they simply are not in the Numerati.
控制。
Control.
所以在这里,如果我们达到这种状态。
So here, if we get to this state.
我们实际上可以回到零。
We can actually go back to zero.
好吧,最后一篇就是整个故事。
Well, for the last one is the whole story here.
我写了一篇是说负担,最后一篇是针对整个管理或管理。
I wrote the one to say the burden and the last one is for the whole the management or the management.
如果我们的整个底部都被压住了,我们的状态不是零,我们的状态还不是没有,它不是 1000,这意味着我们还没有停止,状态不是 500,即整个状态,那么我们需要去声明 500 并设置我们旧的电台输入来传达您的电台。
If our whole bottom is being pressed and our state is not zero and our state is not already not, it's not 1000, meaning that we are not already stopping and the state is not 500, that is the whole state, then we need to go to state five hundred and set our old input of the stations to do convey your station.
所有的事情都应该通过一个站来表达,而所有的事情都应该通过这个站来设置。
That all should be said through rather a station that all should be set through.
a 此处为 500。
aState 500 here.
五百,这实际上将是我们整个州,我们等待所有车站都在等待。
Five hundred, that will actually be our whole state, we wait for all the stations to be holding.
因此,如果。
So if.
输送机,又来了,卡菲,这条线在这里,对不起,这条线在这里。
Conveyers, that's again, Carfi, this line over here, sorry, this line over here.
如果站状态等于保持并且滚动站也是如此,则。
If the station state is equal to holding and the same goes for the roll station, then.
为了将电台重置为伊朗国家,我们需要没有或没有按钮,因为两个电台都快要死了,整个负担不再被按下。
We need to in order to reset the station to the Iranian state, we need to not have and not do not have the button is both stations are all dying and the whole burden is not being pressed anymore.
抱歉,提取的传送带站应该等于跌落,而机器人站应该等于力,而我们返回到等于 10 的状态,在该状态中,我们等待站落下。跑步。
Both the extracted sorry, not the extraction that was the conveyor station that all should become equal to falls and the robot station should become should become equal to force while we go back to the state equal to 10 in which we wait for the station to be running.
之后我们回到C20。
And after that we go back to C20.
好的,我们编写了程序管理,并在下一个视频中声明并调用了所有通用设备。
OK, so we wrote the program management and we we declared and called all the generic devices in the next video.
所以我们将开始编写传送带和记忆站的核心代码。
So we will start writing the core code for the conveyor and remember station.